package com.powernode.teatraceability.dao.sourceinfo;

import com.powernode.teatraceability.pojo.sourceinfo.SourceCode;
import com.powernode.teatraceability.pojo.sourceinfo.SymInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
@Mapper
public interface SourceCodeMapper {

    List<SourceCode> selectAll(String qydm);

    int insert(SourceCode sourceCode);

    int updateSmcs(@Param("bh") int bh,@Param("smcs") int smcs);
/*    @Select("select cdfzr, ph,trsd, trwd, pic,  jcjg, smcs, sym, cptp, tc.chandi chandi,detailAddress," +
            "lng,lat,cdt,cpjs,t.cpmc cpmc,qymc,scrq,cpgg,cpbzq,fzr,fzrtel,jcpic,yjpic,lspic,wghpic," +
            "dlpic,qtpic from t_sym " +
            "join t_chandi tc on t_sym.cdbh = tc.cdbh " +
            "join t_cppc t on t_sym.cpbh = t.cpbh  " +
            "join t_product on t_product.cpmc = t.cpmc " +
            "join t_qy_basic tqb on t.qydm = tqb.qydm " +
            "join t_jcxx tj on t_product.cpmc = tj.cpmc  " +
            "join t_schj ts on t.chandi = ts.chandi  " +
            "where sym = #{sym} LIMIT 1;")
    SymInfo selctInfoBySym(String sym);*/
    @Select("select cdfzr, ph,trsd, trwd, pic,  jcjg, smcs, sym, cptp, tc.chandi chandi," +
            "detailAddress,lng,lat,cdt,cpjs, t.cpmc cpmc,qymc,t_product.scrq scrq,cpgg,cpbzq,fzr," +
            "fzrtel,jcpic,yjpic,lspic,wghpic,dlpic,qtpic " +
            "from t_sym " +
            "join t_chandi tc on t_sym.cdbh = tc.cdbh " +
            "join t_schj ts on tc.chandi = ts.chandi " +
            "join t_product on t_product.cpbh = t_sym.cpbh " +
            "join t_cppc t on t_sym.cpbh = t.cpbh and t_sym.pch = t.pch " +
            "join t_jcxx tj on t.cpmc = tj.cpmc and t.pch = tj.pch " +
            "join t_qy_basic tqb on t.qydm = tqb.qydm " +
            "where sym = #{sym} LIMIT 1;")
    SymInfo selctInfoBySym(String sym);
    @Update("update t_sym set smcs = smcs + 1 where sym = #{sym};")
    int addSmcs(String sym);
}
